<?php
$this->title = "Groups";
$this->headTitle($this->title);
?>	

		
		<!-- start content -->
		<div id="groups_inside" class="content">
			<div id="InnerMenu">
				<ul>
					<li>
						<a href="<?php echo $this->url(array('controller'=>'Group','action'=>'createnew'));?>">
						Create new</a>
					</li>
					<li>
						<a href="<?php echo $this->url(array('controller'=>'Search','action'=>'index'));?>">
						Search groups</a>
					</li>
				</ul>
				 
			</div>
			<br />
			
			<p><b>My groups: </b></p>
			
			<table title="My Groups" id="hor-minimalist-a" >
				<thead>
				<tr>
					<th>Name</th>
					<th>Info</th>
					<th>Admin</th>
					<th>&nbsp;</th>
					<th>&nbsp;</th>
				</tr>
				</thead>
			<?php foreach($this->gm as $gm) : ?>
				<tbody>
				<tr>
					<td>
						<?php $groups = $this->groupOB->getGroup($gm['Group_id']);
						      echo $this->escape($groups['Name']);?>
					</td>
					<td>
						<?php echo $this->escape($groups['Info']); ?>
					</td>
					<td>
						<?php $admin = $this->userOB->getUser($groups['GroupCreator_id']);
							  echo $this->escape($admin['Username']);
						?>
					</td>
					<td>
						<a href="<?php  echo $this->url(array('controller'=>'Group','action'=>'leavegrp', 'grpID'=>(int)$groups['id'], 'userID'=>(int)$this->userID));?>">Leave</a>						
					</td>
					<td>
						<a href="<?php echo $this->url(array('controller'=>'Group','action'=>'viewgroup'))."?id=". (int)$groups['id'] ?>">View</a>
					</td>
				</tr>
				</tbody>
			<?php endforeach; ?>
			</table>
			
		</div>
		<!-- end content -->
